<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>价格表管理</title>
	<meta name="decorator" content="ani"/>
	<script type="text/javascript">
		var validateForm;
		var $table; // 父页面table表格id
		var $topIndex;//弹出窗口的 index
		function doSubmit(table, index){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
		  if(validateForm.form()){
			  $table = table;
			  $topIndex = index;
			  jp.loading();
			  $("#inputForm").submit();
			  return true;
		  }

		  return false;
		}

		$(document).ready(function() {
            $('#date').datetimepicker({
                format: "YYYY-MM-DD"



            });
            $('#sxdate').datetimepicker({
                format: "YYYY-MM-DD"



            });
			validateForm = $("#inputForm").validate({
				submitHandler: function(form){
					jp.post("${ctx}/infor/price/save",$('#inputForm').serialize(),function(data){
						if(data.success){
	                    	$table.bootstrapTable('refresh');
	                    	jp.success(data.msg);
	                    	jp.close($topIndex);//关闭dialog

	                    }else{
            	  			jp.error(data.msg);
	                    }
					})
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			
		});
	</script>
</head>
<body class="bg-white">
		<form:form id="inputForm" modelAttribute="price" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>	
		<table class="table table-bordered">
		   <tbody>
				<tr>
					<td class="width-10 active"><label class="pull-right">项目名称：</label></td>
					<td class="width-23">
						<sys:gridselect    url="${ctx}/infor/project/data" id="project" name="projectName.id" value="${price.projectName.id}" labelName="projectName.name" labelValue="${price.projectName.name}"
										   title="选择项目" cssClass="form-control required" fieldLabels="名称" fieldKeys="name" searchLabels="名称" searchKeys="name"  ></sys:gridselect>

					</td>
					<td class="width-10 active"><label class="pull-right">生效日期：</label></td>
					<td class="width-23">

						<div class='input-group form_datetime' id='sxdate'>
							<input type='text'  name="min" class="form-control "  value="<fmt:formatDate value="${price.min}" pattern="yyyy-MM-dd"/>"/>
							<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
						</div>

					</td>
					<td class="width-10 active"><label class="pull-right">失效日期：</label></td>
					<td class="width-23">

						<div class='input-group form_datetime' id='date'>
							<input type='text'  name="max" class="form-control "  value="<fmt:formatDate value="${price.max}" pattern="yyyy-MM-dd"/>"/>
							<span class="input-group-addon">
			                        <span class="glyphicon glyphicon-calendar"></span>
			                    </span>
						</div>

					</td>

				</tr>
				<tr><td class="width-10 active"><label class="pull-right">作业类型：</label></td>
					<td class="width-23">
						<form:select path="mo" class="form-control ">
							<form:options items="${fns:getDictList('workType')}" itemLabel="label" itemValue="value" htmlEscape="false"/>
						</form:select>
					</td>

					<td class="width-10 active"><label class="pull-right">起运地：</label></td>
					<td class="width-23">
						<sys:gridselect    url="${ctx}/infor/start/data" id="start" name="start.id" value="${price.start.id}" labelName="start.name" labelValue="${price.start.name}"
										   title="选择起运地" cssClass="form-control required" fieldLabels="名称" fieldKeys="name" searchLabels="名称" searchKeys="name"  ></sys:gridselect>
					</td>
					<td class="width-10 active"><label class="pull-right">结算地：</label></td>
					<td class="width-23">
						<sys:gridselect    url="${ctx}/infor/settlement/data" id="settlement" name="address.id" value="${price.address.id}" labelName="address.name" labelValue="${price.address.name}"
										   title="选择到站地" cssClass="form-control required" fieldLabels="名称" fieldKeys="name" searchLabels="名称" searchKeys="name"  ></sys:gridselect>

					</td>

				</tr>
				<tr>
					<td class="width-10 active"><label class="pull-right">区间1：</label></td>
					<td class="width-23">
						<sys:gridselect    url="${ctx}/infor/width/data" id="width1" name="width1.id" value="${price.width1.id}" labelName="width1.width" labelValue="${price.width1.width}"
										   title="选择区间" cssClass="form-control required" fieldLabels="名称" fieldKeys="width" searchLabels="名称" searchKeys="width"  ></sys:gridselect>

					</td>
					<td class="width-10 active"><label class="pull-right">价格1：</label></td>
					<td class="width-23">
						<form:input path="price1" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">附加费1：</label></td>
					<td class="width-23">
						<form:input path="ad1" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>

					<td class="width-10 active"><label class="pull-right">区间2：</label></td>
					<td class="width-23">
						<sys:gridselect    url="${ctx}/infor/width/data" id="width2" name="width2.id" value="${price.width2.id}" labelName="width2.width" labelValue="${price.width2.width}"
										   title="选择区间" cssClass="form-control required" fieldLabels="名称" fieldKeys="width" searchLabels="名称" searchKeys="width"  ></sys:gridselect>

					</td>
					<td class="width-10 active"><label class="pull-right">价格2：</label></td>
					<td class="width-23">
						<form:input path="price2" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">附加费2：</label></td>
					<td class="width-23">
						<form:input path="ad2" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>

					<td class="width-10 active"><label class="pull-right">区间3：</label></td>
					<td class="width-23">
						<sys:gridselect    url="${ctx}/infor/width/data" id="width3" name="width3.id" value="${price.width3.id}" labelName="width3.width" labelValue="${price.width3.width}"
										   title="选择区间" cssClass="form-control required" fieldLabels="名称" fieldKeys="width" searchLabels="名称" searchKeys="width"  ></sys:gridselect>
					</td>
					<td class="width-10 active"><label class="pull-right">价格3：</label></td>
					<td class="width-23">
						<form:input path="price3" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">附加费3：</label></td>
					<td class="width-23">
						<form:input path="ad3" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>

				<tr>
					<td class="width-10 active"><label class="pull-right">区间4：</label></td>
					<td class="width-23">
						<sys:gridselect    url="${ctx}/infor/width/data" id="width4" name="width4.id" value="${price.width4.id}" labelName="width4.width" labelValue="${price.width4.width}"
										   title="选择区间" cssClass="form-control required" fieldLabels="名称" fieldKeys="width" searchLabels="名称" searchKeys="width"  ></sys:gridselect>
					</td>
					<td class="width-10 active"><label class="pull-right">价格4：</label></td>
					<td class="width-23">
						<form:input path="price4" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">附加费4：</label></td>
					<td class="width-23">
						<form:input path="ad4" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>

					<td class="width-10 active"><label class="pull-right">区间5：</label></td>
					<td class="width-23">
						<sys:gridselect    url="${ctx}/infor/width/data" id="width5" name="width5.id" value="${price.width5.id}" labelName="width5.width" labelValue="${price.width5.width}"
										   title="选择区间" cssClass="form-control " fieldLabels="名称" fieldKeys="width" searchLabels="名称" searchKeys="width"  ></sys:gridselect>

					</td>

					<td class="width-10 active"><label class="pull-right">价格5：</label></td>
					<td class="width-23">
						<form:input path="price5" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">附加费5：</label></td>
					<td class="width-23">
						<form:input path="ad5" htmlEscape="false"    class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-10 active"><label class="pull-right">特殊单价：</label></td>
					<td class="width-23">
						<form:input path="price" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">最大里程：</label></td>
					<td class="width-23">
						<form:input path="maxm" htmlEscape="false"    class="form-control "/>
					</td>
					<td class="width-10 active"><label class="pull-right">最小里程：</label></td>
					<td class="width-23">
						<form:input path="minm" htmlEscape="false"    class="form-control "/>
					</td>

				</tr>
		 	</tbody>
		</table>
	</form:form>
</body>
</html>